#ifndef ANIM_TRACK_H
#define ANIM_TRACK_H

#include <QtQmlIntegration>
#include <QPointer>

#include "AnimSource.h"
#include "PoseNode.h"

class AnimTrack:public PoseNode
{
    Q_OBJECT
    QML_ELEMENT
public:
    AnimTrack();


    Pose getEntry() override;
    AnimSource *source() const;
    void setSource(AnimSource *newSource);

    float index() const;
    void setIndex(float newIndex);

    float movement() const;
    void setMovement(float newMovement);

signals:
    void sourceChanged();
    void indexChanged();
    void movementChanged();

private:
    float m_movement = 0;//当前时刻，0代表起始 1代表结束
    float m_index = 0;//动画轨迹id
    QPointer<AnimSource> m_source;//动画源
    Q_PROPERTY(AnimSource *source READ source WRITE setSource NOTIFY sourceChanged FINAL)
    Q_PROPERTY(float index READ index WRITE setIndex NOTIFY indexChanged FINAL)
    Q_PROPERTY(float movement READ movement WRITE setMovement NOTIFY movementChanged FINAL)
};

#endif
